home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / mui / mui-tools / multiuser / src / support / locale.c < prev    next >
C/C++ Source or Header  |  1995-03-09  |  2KB  |  76 lines

  1. /************************************************************
  2. * MultiUser - MultiUser Task/File Support System                *
  3. * ---------------------------------------------------------    *
  4. * localized strings for    support commands                            *
  5. * ---------------------------------------------------------    *
  6. * © Copyright 1993-1994 Geert Uytterhoeven                        *
  7. * All Rights Reserved.                                                    *
  8. ************************************************************/
  9.  
  10. #include "Locale.h"
  11.  
  12. #include <proto/exec.h>
  13. #include <proto/locale.h>
  14.  
  15. #define MULTIUSERSUPPORTCATALOGNAME    "multiuser_support.catalog"
  16. #define MULTIUSERSUPPORTCATALOGVERSION 1 /* :-) */
  17.  
  18. #ifndef SIMPLE_LOCALE
  19.  
  20. #define LocaleBase li->li_LocaleBase
  21.  
  22. void _OpenLoc(struct ExecBase *SysBase,struct LocaleInfo *li)
  23. {
  24.     li->li_LocaleBase = OpenLibrary("locale.library",38);
  25.     if    (LocaleBase)
  26.         li->li_Catalog = OpenCatalog(0,MULTIUSERSUPPORTCATALOGNAME,
  27.                                      OC_BuiltInLanguage,"english",
  28.                                      OC_Version,MULTIUSERSUPPORTCATALOGVERSION,
  29.                                      TAG_DONE);
  30.     else
  31.         li->li_Catalog = 0;
  32. }
  33.  
  34. void _CloseLoc(struct ExecBase *SysBase,struct LocaleInfo *li)
  35. {
  36.     if    (li->li_LocaleBase) {
  37.         CloseCatalog(li->li_Catalog);
  38.         CloseLibrary(li->li_LocaleBase);
  39.     }
  40. }
  41.  
  42. STRPTR _GetLocS(struct ExecBase *SysBase,struct LocaleInfo *li,LONG id,STRPTR defstr)
  43. {
  44.     if    (LocaleBase)
  45.         return(GetCatalogStr(li->li_Catalog,id,defstr));
  46.     else
  47.         return(defstr);
  48. }
  49.  
  50. #undef LocaleBase
  51.  
  52. #else
  53.  
  54. STRPTR _GetLocStr(struct ExecBase *SysBase,LONG id,STRPTR defstr)
  55. {
  56.     struct Library *LocaleBase;
  57.     struct Catalog *cat;
  58.     STRPTR s;
  59.  
  60.     LocaleBase = OpenLibrary("locale.library",38);
  61.     if    (LocaleBase) {
  62.         cat = OpenCatalog(0,MULTIUSERSUPPORTCATALOGNAME,
  63.                             OC_BuiltInLanguage,"english",
  64.                             OC_Version,MULTIUSERSUPPORTCATALOGVERSION,
  65.                             TAG_DONE);
  66.         s = GetCatalogStr(cat,id,defstr);
  67.         CloseCatalog(cat);
  68.         CloseLibrary(LocaleBase);
  69.     }
  70.     else s = defstr;
  71.  
  72.     return(s);
  73. }
  74.  
  75. #endif
  76.